var g_comm = new Object();
//网关服务地址
g_comm.gateway_url = "http://localhost:8003";

//测速后台服务地址
g_comm.manager_url = g_comm.gateway_url;

//文件上传服务地址
g_comm.file_url = g_comm.gateway_url;

//系统名称
g_comm.systemName="Java智能快速开发框架";

//权限
g_comm.perms = localStorage.getItem("speed-test-perms");

g_comm.basePath = getBasePath();

g_comm.viewsPath = g_comm.basePath + "/views";

//全局token
g_comm.token = localStorage.getItem("speed-test-token");
if(!g_comm.token){
    var pathname = window.location.pathname;
    if(pathname.indexOf("login.html") < 0){
        window.location.replace(g_comm.viewsPath+"/login.html")
    }
}

function getRootPath() {
    var pathName = window.location.pathname.substring(1);
    var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));
    if (webName == "") {
        return window.location.protocol + '//' + window.location.host;
    }
    else {
        return window.location.protocol + '//' + window.location.host + '/' + webName;
    }
}

function getBasePath() {
    return window.location.protocol + '//' + window.location.host;
}